<?php

include_once("../db/bancos.class.php");

$bancos = new bancos();
$bancosArray=$bancos->readArray();

//print_r($bancosArray);die();
// Start XML file, create parent node
$dom = new DOMDocument('1.0');
$node = $dom->createElement("bancos");
$parnode = $dom->appendChild($node); 



foreach ($bancosArray as $banco){
	$node = $dom->createElement("banco");
	$newnode = $parnode->appendChild($node);
	$newnode->setAttribute("id", utf8_encode($banco->getId()));
	$newnode->setAttribute("nombre", utf8_encode($banco->getNombre()));
	$newnode->setAttribute("direccion", utf8_encode($banco->getDireccion()));
	$newnode->setAttribute("telefono", utf8_encode($banco->getTelefono()));
	$newnode->setAttribute("horario", utf8_encode($banco->getHorario()));
	$newnode->setAttribute("lat", utf8_encode($banco->getLat()));
	$newnode->setAttribute("lng", utf8_encode($banco->getLng()));
	$newnode->setAttribute("icono", "banco");
	
}
header("Content-type: text/xml");
echo $dom->saveXML();
?>
